package com.threeti.mecool.common.resource;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;

import javax.xml.namespace.QName;


/** TODO jay:exception handling*/
public interface ContentRepo {

	void setCredentials(String username, String password);
	void setCredentials(String username, String password, String domain, String workstation);
	
	List<Content> list(String location) throws IOException;

	List<Content> list(String location, int depth) throws IOException;

	List<Content> patch(String location, Map<QName, String> addProps) throws IOException;
	
	List<Content> patch(String location, Map<QName, String> addProps, List<QName> removeProps) throws IOException;
	
	Content get(String location) throws IOException;
	
	Content get(String location, Map<String, String> headers) throws IOException;

	void put(String location, byte[] data) throws IOException;

	void put(String location, InputStream dataStream) throws IOException;
	void put(String location, InputStream dataStream, boolean isStreamCloseQuietly) throws IOException;

	void put(String location, byte[] data, String contentType) throws IOException;
	
	void put(String location, InputStream dataStream, String contentType) throws IOException;
	
	void put(String location, InputStream dataStream, String contentType, boolean expectContinue) throws IOException;

	void put(String location, InputStream dataStream, Map<String, String> headers) throws IOException;

	/** 资源删除 目前暂不支持级联删除 */
	void delete(String location) throws IOException;

	void createDirectory(String location) throws IOException;

	void move(String sourcelocation, String destinationlocation) throws IOException;
	
	void copy(String sourcelocation, String destinationlocation) throws IOException;

	boolean exists(String location) throws IOException;

	String lock(String location) throws IOException;

	void unlock(String location, String token) throws IOException;

	void enableCompression();

	void disableCompression();

	void enablePreemptiveAuthentication(String hostname);

	void disablePreemptiveAuthentication();

}
